import Vue from "vue";
import Vuex from "vuex";
import * as types from './types'
Vue.use(Vuex);


export default new Vuex.Store({
    state: {
        user: {},
        token: null,
        title: '',
        wxShare:{sing:false,data:{}},
        appNestState:false,
        showPop:true
    },
    mutations: {
        [types.LOGIN]: (state, data) => {
            localStorage.token = data;
            state.token = data;
        },
        [types.LOGOUT]: (state) => {
            localStorage.removeItem('token');
            state.token = null
        },
        [types.TITLE]: (state, data) => {
            state.title = data;
        },
        wxShare: (state, data) => {
            state.wxShare = data;
        },
        setAppNestState: (state, data) => {
            localStorage.appNestState = data;
            state.appNestState = data;
        },
        setshowPop: (state, data) => {
            localStorage.showPop = data;
            state.showPop = data;
        },

    }
})